package websocket.dto;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.List;

/**
 * 分页数据封装
 *
 * @author wangfei
 * @version v1.0
 * @since 2019/7/24 1:02
 */
@ApiModel(value = "分页数据封装对象")
@JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
public class PageDTO<T> {
    private static final long serialVersionUID = 8545996863226528798L;
    /**
     * 返回数据
     */
    @ApiModelProperty(name = "message", value = "返回数据")
    private List<T> records;
    /**
     * 总行数
     */
    @ApiModelProperty(name = "message", value = "总行数")
    private Long total;
    /**
     * 每页行数
     */
    @ApiModelProperty(name = "message", value = "每页行数")
    private Long size;
    /**
     * 当前页数
     */
    @ApiModelProperty(name = "current", value = "当前页数")
    private Long current;

    public List<T> getRecords() {
        return records;
    }

    public void setRecords(List<T> records) {
        this.records = records;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public long getCurrent() {
        return current;
    }

    public void setCurrent(long current) {
        this.current = current;
    }

    @Override
    public String toString() {
        return "PageDTO{" +
                "records=" + records +
                ", total=" + total +
                ", size=" + size +
                ", current=" + current +
                '}';
    }
}
